tpl1="""
execute at @s if score @s advm_battery_swapper_available matches -1 if data block ~ ~ ~ Items[{{Slot:{id}b}}].tag.battery store result score @s advm_battery_swapper_temp1 run data get block ~ ~ ~ Items[{{Slot:{id}b}}].tag.battery
execute at @s if score @s advm_battery_swapper_temp1 matches 1 if data block ~ ~ ~ Items[{{Slot:{id}b}}].tag.battery run scoreboard players set @s advm_battery_swapper_available {id}
"""

with open("gen.txt","w+") as f:
    for i in range(0,27):
        f.write(tpl1.format(id=str(i)))